package 蓝桥真题;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class 等差数列 {
	   static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	   final static int N=1000010;
	   static int a[]=new int[N],n;
       
	   
       public static void main(String[] args) throws Exception {
    	      n=Integer.parseInt(br.readLine());
    	      if(n<=2){
    	    	  System.out.print(2);
    	    	  return;
    	      }
		      String[]ss=br.readLine().split(" ");
		      for(int i=0;i<n;i++)
		    	  a[i]=Integer.parseInt(ss[i]);
		      Arrays.sort(a, 0, n);
		      int d=a[1]-a[0];
		      if(d==0){
		    	  System.out.print(2);
    	    	  return;
		      }
		      while(d>0){
		    	   boolean flag=true;
		    	   for(int i=2;i<n;i++){
		    		   if((a[i]-a[i-1])%d!=0){
		    			   flag=false;
		    			   break;
		    		   }
		    	   }
		    	   if(flag){
		    		   System.out.print((a[n-1]-a[0])/d+1);
		    		   break;
		    	   }
		    	   d/=2;
		      }
	}
}
